package lesson01;

/**
 * 观察多线程现象
 *
 * @author wileda
 * @date 2023/01/03  16:10
 */
public class Demo02 {
    public static void main(String[] args) {
        MyThread02 myThread02 = new MyThread02();
        myThread02.start();
        while(true){
            System.out.println("main thread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

class MyThread02 extends Thread{
    @Override
    public void run() {
        while(true){
            System.out.println("hello my thread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
          }
    }
}
